﻿function enter(pi) {
    try {
        var eim = pi.getEventInstance();
        var cp = eim.getObjectProperty("cp");
        if (pi.getPlayer().getParty() != null && pi.getMap().getMonsterById(9300438) != null && pi.isLeader() && parseInt(cp) > 100) {
            eim.setObjectProperty("cp", 0);
            //if (pi.getPlayer().getEventInstance() != null) {
            //	pi.warpParty_Instanced(((pi.getPlayer().getMapId() / 100) + 1) * 100 - (pi.getPlayer().getMapId() % 100));
            //} else {
            pi.warpParty(((pi.getPlayer().getMapId() / 100) + 1) * 100 - (pi.getPlayer().getMapId() % 100));
            //}
            pi.playPortalSE();
        } else {
            pi.playerMessage(5, "请组队长进入传送口. 需清理100只狼, 目前已杀死" + cp + "只狼");
        }
    } catch (e) {
        pi.playerMessage(5, "Error: " + e);
    }
}